package main

import "fmt"

/*
   map切片
*/
func main() {
	//声明一个map切片
	var students []map[string]string
	//对切片分配内存
	students = make([]map[string]string, 2)
	//切片对应的map也需要分配内存
	if students[0] == nil {
		students[0] = make(map[string]string, 2)
		students[0]["name"] = "李四"
		students[0]["age"] = "16"
	}
	if students[1] == nil {
		students[1] = make(map[string]string, 2)
		students[1]["name"] = "张三"
		students[1]["age"] = "16"
	}
	//动态添加一个元素
	var student2 = map[string]string{
		"name": "李华",
		"age":  "34",
	}
	students = append(students, student2)
	fmt.Println(students)
}
